From 264b914b8ea04fba3c54207c624ecdcc9bfc33e0 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Thu, 5 May 2022 15:07:02 +0100 Subject: [PATCH] [Migration] Create table thirdparty_logins thirdparty_logins table will be used to store usernames and passwords for third party services. --- application/config/migration.php | 2 +- .../091_create_thirdpartylogins_table.php | 65 +++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 application/migrations/091_create_thirdpartylogins_table.php diff --git a/application/config/migration.php b/application/config/migration.php index ce1144fcc..089697c8e 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 90; +$config['migration_version'] = 91; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/091_create_thirdpartylogins_table.php b/application/migrations/091_create_thirdpartylogins_table.php new file mode 100644 index 000000000..f355c29e3 --- /dev/null +++ b/application/migrations/091_create_thirdpartylogins_table.php @@ -0,0 +1,65 @@ +db->table_exists('thirdparty_logins')) { + $this->dbforge->add_field(array( + 'service_id' => array( + 'type' => 'BIGINT', + 'constraint' => 20, + 'unsigned' => TRUE, + 'auto_increment' => TRUE, + 'unique' => TRUE + ), + + 'user_id' => array( + 'type' => 'BIGINT', + 'constraint' => 20, + 'unsigned' => TRUE, + 'auto_increment' => FALSE + ), + + 'service_name' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE + ), + + 'service_password' => array( + 'type' => 'VARCHAR', + 'constraint' => '255', + 'null' => TRUE + ), + + 'active' => array( + 'type' => 'BOOLEAN', + 'null' => TRUE + ), + + 'modified' => array( + 'type' => 'timestamp', + 'null' => TRUE, + ) + )); + + $this->dbforge->add_key('service_id', TRUE); + $this->dbforge->add_key('user_id', TRUE); + + $this->dbforge->create_table('thirdparty_logins'); + } + } + + public function down() + { + $this->dbforge->drop_table('thirdparty_logins'); + } +} \ No newline at end of file