From f817e20f287a21e2dddfba9721f5e02dce162d29 Mon Sep 17 00:00:00 2001
From: Nils Adermann <naderman@naderman.de>
Date: Fri, 15 Jul 2011 11:57:53 -0400
Subject: [feature/migrations] Basic migrations with schema and data changes

The migrator takes care of applying migrations as necessary.

RFC: http://area51.phpbb.com/phpBB/viewtopic.php?f=84&t=41337

PHPBB3-9737
---
 phpBB/install/schemas/mssql_schema.sql | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

(limited to 'phpBB/install/schemas/mssql_schema.sql')

diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index 84c975942f..1174cdfa3d 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -696,6 +696,23 @@ CREATE  INDEX [user_id] ON [phpbb_login_attempts]([user_id]) ON [PRIMARY]
 GO
 
 
+/*
+	Table: 'phpbb_migrations'
+*/
+CREATE TABLE [phpbb_migrations] (
+	[migration_name] [varchar] (255) DEFAULT ('') NOT NULL ,
+	[migration_schema_done] [int] DEFAULT (0) NOT NULL ,
+	[migration_data_done] [int] DEFAULT (0) NOT NULL ,
+	[migration_data_state] [varchar] (8000) DEFAULT ('') NOT NULL ,
+	[migration_start_time] [int] DEFAULT (0) NOT NULL ,
+	[migration_end_time] [int] DEFAULT (0) NOT NULL 
+) ON [PRIMARY]
+GO
+
+CREATE  UNIQUE  INDEX [migration_name] ON [phpbb_migrations]([migration_name]) ON [PRIMARY]
+GO
+
+
 /*
 	Table: 'phpbb_moderator_cache'
 */
-- 
cgit v1.2.1


From 5c91e2569cb3a400acd20bf06cc0e609dd63a778 Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Tue, 8 Jan 2013 22:09:14 -0600
Subject: [feature/migrations] Migrations now somewhat works

PHPBB3-9737
---
 phpBB/install/schemas/mssql_schema.sql | 42 +++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 19 deletions(-)

(limited to 'phpBB/install/schemas/mssql_schema.sql')

diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index 1174cdfa3d..43b8f3e556 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -696,23 +696,6 @@ CREATE  INDEX [user_id] ON [phpbb_login_attempts]([user_id]) ON [PRIMARY]
 GO
 
 
-/*
-	Table: 'phpbb_migrations'
-*/
-CREATE TABLE [phpbb_migrations] (
-	[migration_name] [varchar] (255) DEFAULT ('') NOT NULL ,
-	[migration_schema_done] [int] DEFAULT (0) NOT NULL ,
-	[migration_data_done] [int] DEFAULT (0) NOT NULL ,
-	[migration_data_state] [varchar] (8000) DEFAULT ('') NOT NULL ,
-	[migration_start_time] [int] DEFAULT (0) NOT NULL ,
-	[migration_end_time] [int] DEFAULT (0) NOT NULL 
-) ON [PRIMARY]
-GO
-
-CREATE  UNIQUE  INDEX [migration_name] ON [phpbb_migrations]([migration_name]) ON [PRIMARY]
-GO
-
-
 /*
 	Table: 'phpbb_moderator_cache'
 */
@@ -733,6 +716,27 @@ CREATE  INDEX [forum_id] ON [phpbb_moderator_cache]([forum_id]) ON [PRIMARY]
 GO
 
 
+/*
+	Table: 'phpbb_migrations'
+*/
+CREATE TABLE [phpbb_migrations] (
+	[migration_name] [varchar] (255) DEFAULT ('') NOT NULL ,
+	[migration_schema_done] [int] DEFAULT (0) NOT NULL ,
+	[migration_data_done] [int] DEFAULT (0) NOT NULL ,
+	[migration_data_state] [varchar] (8000) DEFAULT ('') NOT NULL ,
+	[migration_start_time] [int] DEFAULT (0) NOT NULL ,
+	[migration_end_time] [int] DEFAULT (0) NOT NULL 
+) ON [PRIMARY]
+GO
+
+ALTER TABLE [phpbb_migrations] WITH NOCHECK ADD 
+	CONSTRAINT [PK_phpbb_migrations] PRIMARY KEY  CLUSTERED 
+	(
+		[migration_name]
+	)  ON [PRIMARY] 
+GO
+
+
 /*
 	Table: 'phpbb_modules'
 */
@@ -1128,8 +1132,8 @@ CREATE TABLE [phpbb_reports] (
 	[report_time] [int] DEFAULT (0) NOT NULL ,
 	[report_text] [text] DEFAULT ('') NOT NULL ,
 	[reported_post_text] [text] DEFAULT ('') NOT NULL ,
-	[reported_post_bitfield] [varchar] (255) DEFAULT ('') NOT NULL ,
-	[reported_post_uid] [varchar] (8) DEFAULT ('') NOT NULL 
+	[reported_post_uid] [varchar] (8) DEFAULT ('') NOT NULL ,
+	[reported_post_bitfield] [varchar] (255) DEFAULT ('') NOT NULL 
 ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
 GO
 
-- 
cgit v1.2.1


From d50500860fe44a78c8f29e0f2382b96da17c0b62 Mon Sep 17 00:00:00 2001
From: Nathan Guse <nathaniel.guse@gmail.com>
Date: Thu, 10 Jan 2013 15:09:51 -0600
Subject: [feature/migrations] Store depends on in the database (serialized)

This is required so that when migrations are reverted we can check through
all installed migrations and make sure that all dependencies are handled
properly and so that we are only required to load the migrations files
that could be dependent on the ones installed.

I believe in normal proper use the old way might have worked, but in case
something happens and an unrelated migration file is installed, but cannot
be loaded, this makes sure we do not stop everything unless we absolutely
must (one of those files is dependent on something we want to revert).

PHPBB3-9737
---
 phpBB/install/schemas/mssql_schema.sql | 1 +
 1 file changed, 1 insertion(+)

(limited to 'phpBB/install/schemas/mssql_schema.sql')

diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index 43b8f3e556..e261e73d73 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -721,6 +721,7 @@ GO
 */
 CREATE TABLE [phpbb_migrations] (
 	[migration_name] [varchar] (255) DEFAULT ('') NOT NULL ,
+	[migration_depends_on] [varchar] (8000) DEFAULT ('') NOT NULL ,
 	[migration_schema_done] [int] DEFAULT (0) NOT NULL ,
 	[migration_data_done] [int] DEFAULT (0) NOT NULL ,
 	[migration_data_state] [varchar] (8000) DEFAULT ('') NOT NULL ,
-- 
cgit v1.2.1

