-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1313 from ericenns/hotfix/22.05.2
Hotfix/22.05.2
- Loading branch information
Showing
17 changed files
with
206 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 22 additions & 27 deletions
49
...lity/bioinformatics/irida/database/changesets/22.05/user-account-project-subscription.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,64 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog | ||
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd"> | ||
|
||
<changeSet id="user-account-project-subscription" author="katherine"> | ||
<validCheckSum>8:e75125f4b2af1759f21078bafe3b8ed9</validCheckSum> | ||
<validCheckSum>8:4b751d31b04454a4763d8dca46ef4857</validCheckSum> | ||
<createTable tableName="project_subscription"> | ||
<column name="id" type="bigint(20)" autoIncrement="true"> | ||
<constraints primaryKey="true" nullable="false"/> | ||
<constraints primaryKey="true" nullable="false" /> | ||
</column> | ||
<column name="project_id" type="bigint(20)"> | ||
<constraints foreignKeyName="FK_PROJECT_SUBSCRIPTION_PROJECT" | ||
referencedColumnNames="id" referencedTableName="project" nullable="false"/> | ||
<constraints foreignKeyName="FK_PROJECT_SUBSCRIPTION_PROJECT" referencedColumnNames="id" referencedTableName="project" nullable="false" /> | ||
</column> | ||
<column name="user_id" type="bigint(20)"> | ||
<constraints foreignKeyName="FK_PROJECT_SUBSCRIPTION_USER" | ||
referencedColumnNames="id" referencedTableName="user" nullable="false"/> | ||
<constraints foreignKeyName="FK_PROJECT_SUBSCRIPTION_USER" referencedColumnNames="id" referencedTableName="user" nullable="false" /> | ||
</column> | ||
<column name="email_subscription" type="bit(1)" > | ||
<constraints nullable="false"/> | ||
<column name="email_subscription" type="bit(1)"> | ||
<constraints nullable="false" /> | ||
</column> | ||
<column name="created_date" type="datetime"> | ||
<constraints nullable="false"/> | ||
<constraints nullable="false" /> | ||
</column> | ||
</createTable> | ||
|
||
<addUniqueConstraint columnNames="project_id, user_id" | ||
constraintName="UK_PROJECT_SUBSCRIPTION_PROJECT_USER" tableName="project_subscription"/> | ||
<addUniqueConstraint columnNames="project_id, user_id" constraintName="UK_PROJECT_SUBSCRIPTION_PROJECT_USER" tableName="project_subscription" /> | ||
|
||
<createTable tableName="project_subscription_AUD"> | ||
<column name="id" type="bigint(20)" autoIncrement="true"> | ||
<constraints primaryKey="true" nullable="false"/> | ||
<constraints primaryKey="true" nullable="false" /> | ||
</column> | ||
<column name="REV" type="int(11)"> | ||
<constraints primaryKey="true" nullable="false" | ||
foreignKeyName="FK_PROJECT_SUBSCRIPTION_REVISION" referencedColumnNames="id" | ||
referencedTableName="Revisions"/> | ||
<constraints primaryKey="true" nullable="false" foreignKeyName="FK_PROJECT_SUBSCRIPTION_REVISION" referencedColumnNames="id" referencedTableName="Revisions" /> | ||
</column> | ||
<column name="REVTYPE" type="tinyint(4)"/> | ||
<column name="REVTYPE" type="tinyint(4)" /> | ||
<column name="project_id" type="bigint(20)"> | ||
<constraints nullable="false"/> | ||
<constraints nullable="false" /> | ||
</column> | ||
<column name="user_id" type="bigint(20)"> | ||
<constraints nullable="false"/> | ||
<constraints nullable="false" /> | ||
</column> | ||
<column name="email_subscription" type="bit(1)"> | ||
<constraints nullable="false"/> | ||
<constraints nullable="false" /> | ||
</column> | ||
<column name="created_date" type="datetime"> | ||
<constraints nullable="false"/> | ||
<constraints nullable="false" /> | ||
</column> | ||
</createTable> | ||
|
||
<sql> | ||
INSERT INTO project_subscription (project_id, user_id, email_subscription, created_date) | ||
SELECT project_id, user_id, IF(email_subscription=b'1', 1, 0), now() FROM project_user | ||
SELECT project_id, user_id, MAX(email_subscription), MIN(created_date) FROM | ||
(SELECT project_id, user_id, IF(email_subscription=b'1', 1, 0) as email_subscription, now() as created_date FROM project_user | ||
UNION | ||
SELECT p.project_id, m.user_id, 0, now() from user_group_member m INNER JOIN user_group_project p ON | ||
m.group_id = p.user_group_id; | ||
SELECT p.project_id, m.user_id, 0 as email_subscription, now() as created_date from user_group_member m INNER JOIN user_group_project p ON | ||
m.group_id = p.user_group_id) t group by project_id, user_id; | ||
</sql> | ||
|
||
<dropColumn tableName="project_user" columnName="email_subscription"/> | ||
<dropColumn tableName="project_user_AUD" columnName="email_subscription"/> | ||
<dropColumn tableName="project_user" columnName="email_subscription" /> | ||
<dropColumn tableName="project_user_AUD" columnName="email_subscription" /> | ||
|
||
</changeSet> | ||
</databaseChangeLog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.