mirror of
https://github.com/claradex/nativegallery.git
synced 2025-02-13 09:43:14 +03:00
Create sql_0002.sql
This commit is contained in:
parent
558a5cb4c0
commit
33ce890c07
1 changed files with 41 additions and 0 deletions
41
sqlcore/sql_0002.sql
Normal file
41
sqlcore/sql_0002.sql
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
-- Migration script to update database schema
|
||||||
|
|
||||||
|
-- Drop tables that are no longer needed
|
||||||
|
-- (No tables to drop as all tables in 111.sql exist in 222.sql)
|
||||||
|
|
||||||
|
-- Add new tables from 222.sql that don't exist in 111.sql
|
||||||
|
CREATE TABLE IF NOT EXISTS `contests` (
|
||||||
|
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||||
|
`themeid` int(10) NOT NULL,
|
||||||
|
`opendate` int(100) NOT NULL,
|
||||||
|
`closedate` int(10) NOT NULL,
|
||||||
|
`status` int(10) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `geodb` (
|
||||||
|
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||||
|
`title` text NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `servicekeys` (
|
||||||
|
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||||
|
`token` text NOT NULL,
|
||||||
|
`type` text NOT NULL,
|
||||||
|
`status` int(10) NOT NULL,
|
||||||
|
`content` text NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
-- Modify existing tables to add new columns
|
||||||
|
ALTER TABLE `photos`
|
||||||
|
ADD COLUMN IF NOT EXISTS `pinnedcomment_id` int(10) NOT NULL DEFAULT 0 AFTER `entitydata_id`;
|
||||||
|
|
||||||
|
-- Set AUTO_INCREMENT values for the new tables
|
||||||
|
ALTER TABLE `contests` AUTO_INCREMENT = 1;
|
||||||
|
ALTER TABLE `geodb` AUTO_INCREMENT = 1;
|
||||||
|
ALTER TABLE `servicekeys` AUTO_INCREMENT = 1;
|
||||||
|
|
||||||
|
-- Commit the changes
|
||||||
|
COMMIT;
|
Loading…
Reference in a new issue