Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
framadate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nounous
framadate
Commits
ca00c495
Commit
ca00c495
authored
10 years ago
by
Olivier PEREZ
Browse files
Options
Downloads
Patches
Plain Diff
migration: Create a script to migrate database from 0.8 to 0.9
parent
d37200ad
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
from_0-8_to_0-9.sql
+136
-0
136 additions, 0 deletions
from_0-8_to_0-9.sql
install.mysql.sql
+13
-14
13 additions, 14 deletions
install.mysql.sql
with
149 additions
and
14 deletions
from_0-8_to_0-9.sql
0 → 100644
+
136
−
0
View file @
ca00c495
-- --------------------------------------------------------
--
-- Table structure `poll`
--
CREATE
TABLE
IF
NOT
EXISTS
`poll`
(
`id`
CHAR
(
16
)
NOT
NULL
,
`admin_id`
CHAR
(
24
)
NOT
NULL
,
`title`
TEXT
NOT
NULL
,
`description`
TEXT
,
`admin_name`
VARCHAR
(
64
)
DEFAULT
NULL
,
`admin_mail`
VARCHAR
(
128
)
DEFAULT
NULL
,
`creation_date`
TIMESTAMP
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
`end_date`
TIMESTAMP
NOT
NULL
DEFAULT
'0000-00-00 00:00:00'
,
`format`
VARCHAR
(
1
)
DEFAULT
NULL
,
`editable`
TINYINT
(
1
)
DEFAULT
'0'
,
`receiveNewVotes`
TINYINT
(
1
)
DEFAULT
'0'
,
`active`
TINYINT
(
1
)
DEFAULT
'1'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
-- --------------------------------------------------------
--
-- Table structure `slot`
--
CREATE
TABLE
IF
NOT
EXISTS
`slot`
(
`id`
INT
(
11
)
UNSIGNED
NOT
NULL
AUTO_INCREMENT
,
`poll_id`
CHAR
(
16
)
NOT
NULL
,
`title`
TEXT
,
`moments`
TEXT
,
PRIMARY
KEY
(
`id`
),
KEY
`poll_id`
(
`poll_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
-- --------------------------------------------------------
--
-- Table structure `comment`
--
CREATE
TABLE
IF
NOT
EXISTS
`comment`
(
`id`
INT
(
11
)
UNSIGNED
NOT
NULL
AUTO_INCREMENT
,
`poll_id`
CHAR
(
16
)
NOT
NULL
,
`name`
TEXT
,
`comment`
TEXT
NOT
NULL
,
PRIMARY
KEY
(
`id`
),
KEY
`poll_id`
(
`poll_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
-- --------------------------------------------------------
--
-- Table structure `vote`
--
CREATE
TABLE
IF
NOT
EXISTS
`vote`
(
`id`
INT
(
11
)
UNSIGNED
NOT
NULL
AUTO_INCREMENT
,
`poll_id`
CHAR
(
16
)
NOT
NULL
,
`name`
VARCHAR
(
64
)
NOT
NULL
,
`choices`
TEXT
NOT
NULL
,
PRIMARY
KEY
(
`id`
),
KEY
`poll_id`
(
`poll_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
-- --------------------------------------------------------
--
-- Migrate data from `sondage` to `poll`
--
INSERT
INTO
`poll`
(
`id`
,
`admin_id`
,
`title`
,
`description`
,
`admin_name`
,
`admin_mail`
,
`creation_date`
,
`end_date`
,
`format`
,
`editable`
,
`receiveNewVotes`
,
`active`
)
SELECT
`id_sondage`
,
`id_sondage_admin`
,
`titre`
,
`commentaires`
,
`nom_admin`
,
`mail_admin`
,
`titre`
,
`date_creation`
,
`date_fin`
,
SUBSTR
(
`format`
,
1
,
1
)
AS
`format`
,
CASE
SUBSTR
(
`format`
,
2
,
1
)
WHEN
'+'
THEN
1
ELSE
0
END
AS
`editable`
,
`mailsonde`
,
CASE
SUBSTR
(
`format`
,
2
,
1
)
WHEN
'-'
THEN
0
ELSE
1
END
AS
`active`
FROM
sondage
;
-- --------------------------------------------------------
--
-- Migrate data from `sujet_studs` to `slot`
--
-- TODO Migrate this, is not so simple
/*INSERT INTO `slot`
(`poll_id`, `title`, `moments`)
SELECT `id_sondage`,
FROM `user_studs`;*/
-- --------------------------------------------------------
--
-- Migrate data from `comments` to `comment`
--
INSERT
INTO
`comment`
(
`poll_id`
,
`name`
,
`comment`
)
SELECT
`id_sondage`
,
`usercomment`
,
`comment`
FROM
`comments`
;
-- --------------------------------------------------------
--
-- Migrate data from `user_studs` to `vote`
--
INSERT
INTO
`vote`
(
`poll_id`
,
`name`
,
`choices`
)
SELECT
`id_sondage`
,
`nom`
,
REPLACE
(
REPLACE
(
REPLACE
(
`reponses`
,
'1'
,
'X'
),
'2'
,
'1'
),
'X'
,
2
)
FROM
`user_studs`
;
This diff is collapsed.
Click to expand it.
install.mysql.sql
+
13
−
14
View file @
ca00c495
...
...
@@ -19,8 +19,8 @@ CREATE TABLE IF NOT EXISTS `poll` (
`active`
TINYINT
(
1
)
DEFAULT
'1'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
-- --------------------------------------------------------
...
...
@@ -36,8 +36,8 @@ CREATE TABLE IF NOT EXISTS `slot` (
PRIMARY
KEY
(
`id`
),
KEY
`poll_id`
(
`poll_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
-- --------------------------------------------------------
...
...
@@ -53,8 +53,8 @@ CREATE TABLE IF NOT EXISTS `comment` (
PRIMARY
KEY
(
`id`
),
KEY
`poll_id`
(
`poll_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
-- --------------------------------------------------------
...
...
@@ -70,9 +70,8 @@ CREATE TABLE IF NOT EXISTS `vote` (
PRIMARY
KEY
(
`id`
),
KEY
`poll_id`
(
`poll_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
AUTO_INCREMENT
=
160284
;
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
--
...
...
@@ -101,13 +100,13 @@ INSERT INTO `slot` (`poll_id`, `title`, `moments`) VALUES
INSERT
INTO
`vote`
(
`name`
,
`poll_id`
,
`choices`
)
VALUES
(
'marcel'
,
'aqg259dth55iuhwm'
,
'02202222'
),
(
'paul'
,
'aqg259dth55iuhwm'
,
'20220202'
),
(
'paul'
,
'aqg259dth55iuhwm'
,
'20220202'
),
(
'sophie'
,
'aqg259dth55iuhwm'
,
'22202200'
),
(
'barack'
,
'aqg259dth55iuhwm'
,
'02200000'
),
(
'takashi'
,
'aqg259dth55iuhwm'
,
'00002202'
),
(
'takashi'
,
'aqg259dth55iuhwm'
,
'00002202'
),
(
'albert'
,
'aqg259dth55iuhwm'
,
'20202200'
),
(
'alfred'
,
'aqg259dth55iuhwm'
,
'02200200'
),
(
'marcs'
,
'aqg259dth55iuhwm'
,
'02000020'
),
(
'laure'
,
'aqg259dth55iuhwm'
,
'00220000'
),
(
'benda'
,
'aqg259dth55iuhwm'
,
'22022022'
),
(
'marcs'
,
'aqg259dth55iuhwm'
,
'02000020'
),
(
'laure'
,
'aqg259dth55iuhwm'
,
'00220000'
),
(
'benda'
,
'aqg259dth55iuhwm'
,
'22022022'
),
(
'albert'
,
'aqg259dth55iuhwm'
,
'22222200'
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment