| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bfc4f98 commit fc92502
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,25 +18,25 @@ | |||
| 18 | 18 | -- Add a default ROOT domain | |
| 19 | 19 | use cloud; | |
| 20 | 20 | ||
| 21 | - INSERT INTO `cloud`.`domain` (id, uuid, name, parent, path, owner) VALUES | ||
| 22 | - (1, UUID(), 'ROOT', NULL, '/', 2); | ||
| 21 | + INSERT INTO `cloud`.`domain` (id, uuid, name, parent, path, owner, region_id) VALUES | ||
| 22 | + (1, UUID(), 'ROOT', NULL, '/', 2, 1); | ||
| 23 | 23 | ||
| 24 | 24 | -- Add system and admin accounts | |
| 25 | - INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, state) VALUES | ||
| 26 | - (1, UUID(), 'system', 1, 1, 'enabled'); | ||
| 25 | + INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, state, region_id) VALUES | ||
| 26 | + (1, UUID(), 'system', 1, 1, 'enabled', 1); | ||
| 27 | 27 | ||
| 28 | - INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, state) VALUES | ||
| 29 | - (2, UUID(), 'admin', 1, 1, 'enabled'); | ||
| 28 | + INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, state, region_id) VALUES | ||
| 29 | + (2, UUID(), 'admin', 1, 1, 'enabled', 1); | ||
| 30 | 30 | ||
| 31 | 31 | -- Add system user | |
| 32 | 32 | INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, | |
| 33 | - lastname, email, state, created) VALUES (1, UUID(), 'system', RAND(), | ||
| 34 | - '1', 'system', 'cloud', NULL, 'enabled', NOW()); | ||
| 33 | + lastname, email, state, created, region_id) VALUES (1, UUID(), 'system', RAND(), | ||
| 34 | + '1', 'system', 'cloud', NULL, 'enabled', NOW(), 1); | ||
| 35 | 35 | ||
| 36 | 36 | -- Add system user with encrypted password=password | |
| 37 | 37 | INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, | |
| 38 | - lastname, email, state, created) VALUES (2, UUID(), 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', | ||
| 39 | - '2', 'Admin', 'User', 'admin@mailprovider.com', 'enabled', NOW()); | ||
| 38 | + lastname, email, state, created, region_id) VALUES (2, UUID(), 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', | ||
| 39 | + '2', 'Admin', 'User', 'admin@mailprovider.com', 'enabled', NOW(), 1); | ||
| 40 | 40 | ||
| 41 | 41 | -- Add configurations | |
| 42 | 42 | INSERT INTO `cloud`.`configuration` (category, instance, component, name, value) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -317,16 +317,16 @@ private String getEnvironmentProperty(String name) { | |||
| 317 | 317 | protected void saveUser() { | |
| 318 | 318 | //ToDo: Add regionId to default users and accounts | |
| 319 | 319 | // insert system account | |
| 320 | - String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id) VALUES (1, UUID(), 'system', '1', '1')"; | ||
| 320 | + String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, region_id) VALUES (1, UUID(), 'system', '1', '1', '1')"; | ||
| 321 | 321 | Transaction txn = Transaction.currentTxn(); | |
| 322 | 322 | try { | |
| 323 | 323 | PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); | |
| 324 | 324 | stmt.executeUpdate(); | |
| 325 | 325 | } catch (SQLException ex) { | |
| 326 | 326 | } | |
| 327 | 327 | // insert system user | |
| 328 | - insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created)" + | ||
| 329 | - " VALUES (1, UUID(), 'system', RAND(), 1, 'system', 'cloud', now())"; | ||
| 328 | + insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created, region_id)" + | ||
| 329 | + " VALUES (1, UUID(), 'system', RAND(), 1, 'system', 'cloud', now(), '1')"; | ||
| 330 | 330 | txn = Transaction.currentTxn(); | |
| 331 | 331 | try { | |
| 332 | 332 | PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); | |
@@ -342,7 +342,7 @@ protected void saveUser() { | |||
| 342 | 342 | String lastname = "cloud"; | |
| 343 | 343 | ||
| 344 | 344 | // create an account for the admin user first | |
| 345 | - insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id) VALUES (" + id + ", UUID(), '" + username + "', '1', '1')"; | ||
| 345 | + insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, region_id) VALUES (" + id + ", UUID(), '" + username + "', '1', '1', '1')"; | ||
| 346 | 346 | txn = Transaction.currentTxn(); | |
| 347 | 347 | try { | |
| 348 | 348 | PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); | |
@@ -351,8 +351,8 @@ protected void saveUser() { | |||
| 351 | 351 | } | |
| 352 | 352 | ||
| 353 | 353 | // now insert the user | |
| 354 | - insertSql = "INSERT INTO `cloud`.`user` (id, username, password, account_id, firstname, lastname, created, state) " + | ||
| 355 | - "VALUES (" + id + ",'" + username + "', RAND(), 2, '" + firstname + "','" + lastname + "',now(), 'disabled')"; | ||
| 354 | + insertSql = "INSERT INTO `cloud`.`user` (id, username, password, account_id, firstname, lastname, created, state, region_id) " + | ||
| 355 | + "VALUES (" + id + ",'" + username + "', RAND(), 2, '" + firstname + "','" + lastname + "',now(), 'disabled', '1')"; | ||
| 356 | 356 | ||
| 357 | 357 | txn = Transaction.currentTxn(); | |
| 358 | 358 | try { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -911,7 +911,7 @@ CREATE TABLE `cloud`.`user` ( | |||
| 911 | 911 | `timezone` varchar(30) default NULL, | |
| 912 | 912 | `registration_token` varchar(255) default NULL, | |
| 913 | 913 | `is_registered` tinyint NOT NULL DEFAULT 0 COMMENT '1: yes, 0: no', | |
| 914 | - `region_id` int unsigned, | ||
| 914 | + `region_id` int unsigned NOT NULL, | ||
| 915 | 915 | `incorrect_login_attempts` integer unsigned NOT NULL DEFAULT 0, | |
| 916 | 916 | PRIMARY KEY (`id`), | |
| 917 | 917 | INDEX `i_user__removed`(`removed`), | |
@@ -1262,7 +1262,7 @@ CREATE TABLE `cloud`.`domain` ( | |||
| 1262 | 1262 | `state` char(32) NOT NULL default 'Active' COMMENT 'state of the domain', | |
| 1263 | 1263 | `network_domain` varchar(255), | |
| 1264 | 1264 | `type` varchar(255) NOT NULL DEFAULT 'Normal' COMMENT 'type of the domain - can be Normal or Project', | |
| 1265 | - `region_id` int unsigned, | ||
| 1265 | + `region_id` int unsigned NOT NULL, | ||
| 1266 | 1266 | PRIMARY KEY (`id`), | |
| 1267 | 1267 | UNIQUE (parent, name, removed), | |
| 1268 | 1268 | INDEX `i_domain__path`(`path`), | |
@@ -1281,7 +1281,7 @@ CREATE TABLE `cloud`.`account` ( | |||
| 1281 | 1281 | `cleanup_needed` tinyint(1) NOT NULL default '0', | |
| 1282 | 1282 | `network_domain` varchar(255), | |
| 1283 | 1283 | `default_zone_id` bigint unsigned, | |
| 1284 | - `region_id` int unsigned, | ||
| 1284 | + `region_id` int unsigned NOT NULL, | ||
| 1285 | 1285 | PRIMARY KEY (`id`), | |
| 1286 | 1286 | INDEX i_account__removed(`removed`), | |
| 1287 | 1287 | CONSTRAINT `fk_account__default_zone_id` FOREIGN KEY `fk_account__default_zone_id`(`default_zone_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1268,3 +1268,26 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'manag | |||
| 1268 | 1268 | ALTER TABLE `cloud`.`op_dc_vnet_alloc` DROP INDEX i_op_dc_vnet_alloc__vnet__data_center_id; | |
| 1269 | 1269 | ||
| 1270 | 1270 | ALTER TABLE `cloud`.`op_dc_vnet_alloc` ADD CONSTRAINT UNIQUE `i_op_dc_vnet_alloc__vnet__data_center_id`(`vnet`, `physical_network_id`, `data_center_id`); | |
| 1271 | + | ||
| 1272 | + CREATE TABLE `cloud`.`region` ( | ||
| 1273 | + `id` int unsigned NOT NULL UNIQUE, | ||
| 1274 | + `name` varchar(255) NOT NULL UNIQUE, | ||
| 1275 | + `end_point` varchar(255) NOT NULL, | ||
| 1276 | + `api_key` varchar(255), | ||
| 1277 | + `secret_key` varchar(255), | ||
| 1278 | + PRIMARY KEY (`id`) | ||
| 1279 | + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
| 1280 | + | ||
| 1281 | + CREATE TABLE `cloud`.`region_sync` ( | ||
| 1282 | + `id` bigint unsigned NOT NULL auto_increment, | ||
| 1283 | + `region_id` int unsigned NOT NULL, | ||
| 1284 | + `api` varchar(1024) NOT NULL, | ||
| 1285 | + `created` datetime NOT NULL COMMENT 'date created', | ||
| 1286 | + `processed` tinyint NOT NULL default '0', | ||
| 1287 | + PRIMARY KEY (`id`) | ||
| 1288 | + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
| 1289 | + | ||
| 1290 | + INSERT INTO `cloud`.`region` values ('1','Local','http://localhost:8080/client/api','',''); | ||
| 1291 | + ALTER TABLE `cloud`.`account` ADD COLUMN `region_id` int unsigned NOT NULL DEFAULT '1'; | ||
| 1292 | + ALTER TABLE `cloud`.`user` ADD COLUMN `region_id` int unsigned NOT NULL DEFAULT '1'; | ||
| 1293 | + ALTER TABLE `cloud`.`domain` ADD COLUMN `region_id` int unsigned NOT NULL DEFAULT '1'; | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments