UPGRADING 5.23 KB
Newer Older
1 2 3 4 5 6 7 8
2011-11-08:
/* change accounting index accounting_idx4 and accounting_idx5 */
DROP INDEX accounting_idx4 ON accounting;
DROP INDEX accounting_idx5 ON accounting;

CREATE INDEX accounting_idx5 ON accounting (Username,AcctSessionID,NASIPAddress,NASPort,PeriodKey);
CREATE INDEX accounting_idx4 ON accounting (Username,AcctSessionID,NASIPAddress,NASPort);

9 10 11 12 13 14 15
2011-11-04:
/* accounting_stop_status_query */
CREATE INDEX accounting_idx4 ON accounting (Username,AcctSessionID,NASIPAddress,NASPortID);
/* accounting_update_query */
CREATE INDEX accounting_idx5 ON accounting (Username,AcctSessionID,NASIPAddress,NASPortID,PeriodKey);


16 17 18 19 20 21 22
2011-10-14:
	ALTER TABLE accounting_summary ADD COLUMN PeriodKey2 VARCHAR(255) AFTER PeriodKey;
	UPDATE accounting_summary set PeriodKey2 = DATE_FORMAT(PeriodKey,'%Y-%m');
	ALTER TABLE accounting_summary DROP COLUMN PeriodKey;
	ALTER TABLE accounting_summary CHANGE COLUMN PeriodKey2 PeriodKey VARCHAR(255);
	

23

24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
2011-03-22:
	Add users_data table for various functions

	CREATE TABLE @PREFIX@users_data (
		ID 		@SERIAL_TYPE@,

		UserID 		@INT_UNSIGNED@,

		LastUpdated 	DATETIME,

		Name 		VARCHAR(255),

		Value 		VARCHAR(255),

		UNIQUE 		(UserID,Name)
	);


42 43 44
2011-01-11:
	Move configuration file item "use_packet_timestamp=" to "[radius]" section

45 46 47 48 49 50 51
	mkdir /var/log/smradius
	mkdir /var/run/smradius

	If you are running smradius as an unpriv user, then ...
	chown smradius.smradius /var/log/smradius /var/run/smradius


52 53
---

54 55 56 57 58 59
r574:
	# Database

	ALTER TABLE topups ADD COLUMN SMAdminDepletedOn DATETIME;
	ALTER TABLE topups_summary ADD COLUMN SMAdminDepletedOn DATETIME;

60 61 62 63 64 65 66 67 68 69 70 71 72 73
r538:
	# Database

	ALTER TABLE accounting_summary DROP COLUMN AcctSessionTime;
	ALTER TABLE accounting_summary DROP COLUMN AcctInputOctets;
	ALTER TABLE accounting_summary DROP COLUMN AcctInputGigawords;
	ALTER TABLE accounting_summary DROP COLUMN AcctOutputOctets;
	ALTER TABLE accounting_summary DROP COLUMN AcctOutputGigawords;

	ALTER TABLE accounting_summary ADD COLUMN TotalSessionTime INT UNSIGNED;
	ALTER TABLE accounting_summary ADD COLUMN TotalInput INT UNSIGNED;
	ALTER TABLE accounting_summary ADD COLUMN TotalOutput INT UNSIGNED;

r509:
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
	# Database

	ALTER TABLE accounting ADD PeriodKey VARCHAR(7);
	ALTER TABLE accounting_summary DROP COLUMN AcctInputPackets;

	# smradiusd.conf

	Modified:
	accounting_start_query=<<EOT
		INSERT INTO
			@TP@accounting
		(
			Username,
			ServiceType,
			FramedProtocol,
			NASPort,
			NASPortType,
			CallingStationID,
			CalledStationID,
			NASPortID,
			AcctSessionID,
			FramedIPAddress,
			AcctAuthentic,
			EventTimestamp,
			AcctStatusType,
			NASIdentifier,
			NASIPAddress,
			AcctDelayTime,
			PeriodKey
		)
		VALUES
		(
			%{request.User-Name},
			%{request.Service-Type},
			%{request.Framed-Protocol},
			%{request.NAS-Port},
			%{request.NAS-Port-Type},
			%{request.Calling-Station-Id},
			%{request.Called-Station-Id},
			%{request.NAS-Port-Id},
			%{request.Acct-Session-Id},
			%{request.Framed-IP-Address},
			%{request.Acct-Authentic},
			%{request.Timestamp},
			%{request.Acct-Status-Type},
			%{request.NAS-Identifier},
			%{request.NAS-IP-Address},
			%{request.Acct-Delay-Time},
			%{query.PeriodKey}
		)
	EOT

	accounting_update_query=<<EOT
		UPDATE
			@TP@accounting
		SET
			AcctSessionTime = %{query.AcctSessionTime},
			AcctInputOctets = %{query.AcctInputOctets},
			AcctInputGigawords = %{query.AcctInputGigawords},
			AcctInputPackets = %{query.AcctInputPackets},
			AcctOutputOctets = %{query.AcctOutputOctets},
			AcctOutputGigawords = %{query.AcctOutputGigawords},
			AcctOutputPackets = %{query.AcctOutputPackets},
			AcctStatusType = %{request.Acct-Status-Type}
		WHERE
			Username = %{request.User-Name}
			AND AcctSessionID = %{request.Acct-Session-Id}
			AND NASIPAddress = %{request.NAS-IP-Address}
			AND PeriodKey = %{query.PeriodKey}
	EOT

	accounting_stop_query=<<EOT
		UPDATE
			@TP@accounting
		SET
			AcctSessionTime = %{query.Acct-Session-Time},
			AcctInputOctets = %{query.Acct-Input-Octets},
			AcctInputGigawords = %{query.Acct-Input-Gigawords},
			AcctInputPackets = %{query.Acct-Input-Packets},
			AcctOutputOctets = %{query.Acct-Output-Octets},
			AcctOutputGigawords = %{query.Acct-Output-Gigawords},
			AcctOutputPackets = %{query.Acct-Output-Packets}
		WHERE
			Username = %{request.User-Name}
			AND AcctSessionID = %{request.Acct-Session-Id}
			AND NASIPAddress = %{request.NAS-IP-Address}
			AND PeriodKey = %{query.PeriodKey}
	EOT

	Added:
	accounting_update_get_records_query=<<EOT
		SELECT
			SUM(AcctInputOctets) AS InputOctets,
			SUM(AcctInputPackets) AS InputPackets,
			SUM(AcctOutputOctets) AS OutputOctets,
			SUM(AcctOutputPackets) AS OutputPackets,
			SUM(AcctInputGigawords) AS InputGigawords,
			SUM(AcctOutputGigawords) AS OutputGigawords,
			SUM(AcctSessionTime) AS SessionTime,
			PeriodKey
		FROM
			@TP@accounting
		WHERE
			Username = %{request.User-Name}
			AND AcctSessionID = %{request.Acct-Session-Id}
			AND NASIPAddress = %{request.NAS-IP-Address}
		GROUP BY
			PeriodKey
		ORDER BY
			ID ASC
	EOT

	accounting_stop_status_query=<<EOT
		UPDATE
			@TP@accounting
		SET
			AcctStatusType = %{request.Acct-Status-Type},
			AcctTerminateCause = %{request.Acct-Terminate-Cause}
		WHERE
			Username = %{request.User-Name}
			AND AcctSessionID = %{request.Acct-Session-Id}
			AND NASIPAddress = %{request.NAS-IP-Address}
	EOT