CCM NG: Database migrations for Page Model Containers
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5365 8810af33-2d31-482b-a856-94f89814c4dfccm-docs
parent
f825d544f1
commit
fb6235b4b1
|
|
@ -0,0 +1,162 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package db.migrations.org.libreccm.ccm_core;
|
||||||
|
|
||||||
|
import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class V7_0_0_23__move_components_to_container implements JdbcMigration {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void migrate(final Connection connection) throws Exception {
|
||||||
|
|
||||||
|
// Get all draft PageModels from ccm_core.page_models
|
||||||
|
final PreparedStatement retrievePageModels = connection
|
||||||
|
.prepareStatement("select PAGE_MODEL_ID, MODEL_UUID "
|
||||||
|
+ "from CCM_CORE.PAGE_MODELS "
|
||||||
|
+ "where VERSION = 'DRAFT'");
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
For each PageModel:
|
||||||
|
* Create a single container (by inserting the data into
|
||||||
|
ccm_core.page_model_container_models)
|
||||||
|
* set container_id of each component_model of the page_model
|
||||||
|
to the ID of the new container
|
||||||
|
* if the PageModel has a public version do the same but reuse the
|
||||||
|
containerUuid
|
||||||
|
*/
|
||||||
|
final PreparedStatement createContainerId = connection
|
||||||
|
.prepareStatement("select nextval('hibernate_sequence')");
|
||||||
|
final PreparedStatement createContainer = connection
|
||||||
|
.prepareStatement(
|
||||||
|
"insert into CCM_CORE.PAGE_MODEL_CONTAINER_MODELS ("
|
||||||
|
+ " CONTAINER_ID, "
|
||||||
|
+ " CONTAINER_UUID, "
|
||||||
|
+ " CONTAINER_KEY, "
|
||||||
|
+ " UUID, "
|
||||||
|
+ " PAGE_MODEL_ID"
|
||||||
|
+ ") "
|
||||||
|
+ "VALUES ("
|
||||||
|
+ " ?,"
|
||||||
|
+ " ?,"
|
||||||
|
+ " ?,"
|
||||||
|
+ " ?,"
|
||||||
|
+ " ?"
|
||||||
|
+ ")");
|
||||||
|
final PreparedStatement checkForLivePageModel = connection
|
||||||
|
.prepareStatement("select count(PAGE_MODEL_ID) "
|
||||||
|
+ "from CCM_CORE.PAGE_MODELS "
|
||||||
|
+ "where VERSION = 'LIVE' "
|
||||||
|
+ "and model_uuid = ?");
|
||||||
|
final PreparedStatement retrieveLivePage = connection
|
||||||
|
.prepareStatement("select PAGE_MODEL_ID "
|
||||||
|
+ "from CCM_CORE.PAGE_MODELS "
|
||||||
|
+ "where VERSION = 'LIVE' "
|
||||||
|
+ "and model_uuid = ?");
|
||||||
|
final PreparedStatement updateComponents = connection
|
||||||
|
.prepareStatement("update PAGE_MODEL_COMPONENT_MODELS "
|
||||||
|
+ "set CONTAINER_ID = ? "
|
||||||
|
+ "where COMPONENT_MODEL_ID in ("
|
||||||
|
+ " select COMPONENT_MODEL_ID "
|
||||||
|
+ " from PAGE_MODEL_COMPONENT_MODELS "
|
||||||
|
+ " where PAGE_MODEL_ID = ?"
|
||||||
|
+ ")");
|
||||||
|
try (final ResultSet pageModelsResultSet
|
||||||
|
= retrievePageModels.executeQuery()) {
|
||||||
|
|
||||||
|
while (pageModelsResultSet.next()) {
|
||||||
|
|
||||||
|
final long pageModelId = pageModelsResultSet
|
||||||
|
.getLong("PAGE_MODEL_ID");
|
||||||
|
final String modelUuid = pageModelsResultSet
|
||||||
|
.getString("MODEL_UUID");
|
||||||
|
|
||||||
|
final String containerKey = "container";
|
||||||
|
final String containerUuid = UUID.randomUUID().toString();
|
||||||
|
|
||||||
|
final long containerId;
|
||||||
|
try (final ResultSet containerIdResultSet
|
||||||
|
= createContainerId.executeQuery()) {
|
||||||
|
|
||||||
|
containerIdResultSet.next();
|
||||||
|
containerId = containerIdResultSet.getLong("nextval");
|
||||||
|
}
|
||||||
|
|
||||||
|
createContainer.setLong(1, containerId);
|
||||||
|
createContainer.setString(2, containerUuid);
|
||||||
|
createContainer.setString(3, containerKey);
|
||||||
|
createContainer.setString(4, containerUuid);
|
||||||
|
createContainer.setLong(5, pageModelId);
|
||||||
|
createContainer.executeUpdate();
|
||||||
|
|
||||||
|
updateComponents.setLong(1, containerId);
|
||||||
|
updateComponents.setLong(2, pageModelId);
|
||||||
|
updateComponents.executeUpdate();
|
||||||
|
|
||||||
|
checkForLivePageModel.setString(1, modelUuid);
|
||||||
|
final long liveCount;
|
||||||
|
try (final ResultSet liveCountResultSet
|
||||||
|
= checkForLivePageModel.executeQuery()) {
|
||||||
|
|
||||||
|
liveCountResultSet.next();
|
||||||
|
liveCount = liveCountResultSet.getLong("COUNT");
|
||||||
|
}
|
||||||
|
if (liveCount > 0) {
|
||||||
|
|
||||||
|
retrieveLivePage.setString(1, modelUuid);
|
||||||
|
final long livePageModelId;
|
||||||
|
try (final ResultSet liveResultSet
|
||||||
|
= retrieveLivePage.executeQuery()) {
|
||||||
|
liveResultSet.next();
|
||||||
|
livePageModelId = liveResultSet.getLong("PAGE_MODEL_ID");
|
||||||
|
}
|
||||||
|
|
||||||
|
final long liveContainerId;
|
||||||
|
try (final ResultSet liveContainerIdResultSet
|
||||||
|
= createContainerId.executeQuery()) {
|
||||||
|
liveContainerIdResultSet.next();
|
||||||
|
liveContainerId = liveContainerIdResultSet
|
||||||
|
.getLong("nextval");
|
||||||
|
}
|
||||||
|
|
||||||
|
createContainer.setLong(1, liveContainerId);
|
||||||
|
createContainer.setString(2, containerUuid);
|
||||||
|
createContainer.setString(3, containerKey);
|
||||||
|
createContainer.setString(4, UUID.randomUUID().toString());
|
||||||
|
createContainer.setLong(5, livePageModelId);
|
||||||
|
createContainer.executeUpdate();
|
||||||
|
|
||||||
|
updateComponents.setLong(1, liveContainerId);
|
||||||
|
updateComponents.setLong(2, livePageModelId);
|
||||||
|
updateComponents.executeUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package db.migrations.org.libreccm.ccm_core.h2;
|
||||||
|
|
||||||
|
import db.migrations.org.libreccm.ccm_core.V7_0_0_23__move_components_to_container;
|
||||||
|
import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class V7_0_0_23__move_components_to_container_h2
|
||||||
|
extends V7_0_0_23__move_components_to_container
|
||||||
|
implements JdbcMigration {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void migrate(final Connection connection) throws Exception {
|
||||||
|
super.migrate(connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package db.migrations.org.libreccm.ccm_core.pgsql;
|
||||||
|
|
||||||
|
import db.migrations.org.libreccm.ccm_core.V7_0_0_23__move_components_to_container;
|
||||||
|
import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class V7_0_0_23__move_components_to_container_pgsql
|
||||||
|
extends V7_0_0_23__move_components_to_container
|
||||||
|
implements JdbcMigration {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void migrate(final Connection connection) throws Exception {
|
||||||
|
super.migrate(connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -55,7 +55,7 @@ import javax.validation.constraints.NotNull;
|
||||||
@Table(name = "PAGE_MODEL_CONTAINER_MODELS", schema = CoreConstants.DB_SCHEMA)
|
@Table(name = "PAGE_MODEL_CONTAINER_MODELS", schema = CoreConstants.DB_SCHEMA)
|
||||||
@NamedQueries({
|
@NamedQueries({
|
||||||
@NamedQuery(name = "ContainerModel.findByKeyAndPage",
|
@NamedQuery(name = "ContainerModel.findByKeyAndPage",
|
||||||
query = "SELECT c FROM Container c "
|
query = "SELECT c FROM ContainerModel c "
|
||||||
+ "WHERE c.key = :key "
|
+ "WHERE c.key = :key "
|
||||||
+ "AND c.pageModel = :pageModel")
|
+ "AND c.pageModel = :pageModel")
|
||||||
})
|
})
|
||||||
|
|
@ -89,7 +89,7 @@ public class ContainerModel implements Serializable {
|
||||||
* used for the value of the {@code id} or {@code class} attribute in HTML.
|
* used for the value of the {@code id} or {@code class} attribute in HTML.
|
||||||
* It is recommended the use semantic names.
|
* It is recommended the use semantic names.
|
||||||
*/
|
*/
|
||||||
@Column(name = "COMPONENT_KEY", length = 255)
|
@Column(name = "CONTAINER_KEY", length = 255)
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.pagemodel.styles;
|
package org.libreccm.pagemodel.styles;
|
||||||
|
|
||||||
|
import org.libreccm.core.CoreConstants;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
@ -34,7 +36,7 @@ import javax.persistence.Table;
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "STYLE_PROPERTIES")
|
@Table(name = "STYLE_PROPERTIES", schema = CoreConstants.DB_SCHEMA)
|
||||||
public class CssProperty implements Serializable {
|
public class CssProperty implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4697757123207731769L;
|
private static final long serialVersionUID = -4697757123207731769L;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
-- Remove obsolete tables
|
||||||
|
|
||||||
|
alter table CCM_CORE.FLEX_LAYOUT_BOXES
|
||||||
|
drop constraint FKeiqh69t1lr7u09hjuxfyxsbs;
|
||||||
|
|
||||||
|
alter table CCM_CORE.FLEX_LAYOUT_BOXES
|
||||||
|
drop constraint FKmrobhhqidcf1657ugcgatrd0y;
|
||||||
|
|
||||||
|
alter table CCM_CORE.FLEX_LAYOUT_COMPONENTS
|
||||||
|
drop constraint FK8qxnqt75ikxtedx0xreoeiygg;
|
||||||
|
|
||||||
|
drop table CCM_CORE.FLEX_LAYOUT_COMPONENTS;
|
||||||
|
|
||||||
|
drop table CCM_CORE.FLEX_LAYOUT_BOXES;
|
||||||
|
|
||||||
|
-- Create new tables and columns
|
||||||
|
|
||||||
|
alter table CCM_CORE.PAGE_MODEL_COMPONENT_MODELS
|
||||||
|
add column CONTAINER_ID bigint;
|
||||||
|
|
||||||
|
create table CCM_CORE.PAGE_MODEL_CONTAINER_MODELS (
|
||||||
|
CONTAINER_ID bigint not null,
|
||||||
|
CONTAINER_UUID varchar(255) not null,
|
||||||
|
CONTAINER_KEY varchar(255),
|
||||||
|
UUID varchar(255) not null,
|
||||||
|
PAGE_MODEL_ID bigint,
|
||||||
|
STYLE_ID bigint,
|
||||||
|
primary key (CONTAINER_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.STYLE_MEDIA_QUERIES (
|
||||||
|
MEDIA_QUERY_ID bigint not null,
|
||||||
|
MAX_WIDTH_UNIT varchar(255),
|
||||||
|
MAX_WIDTH_VALUE float,
|
||||||
|
MEDIA_TYPE varchar(255),
|
||||||
|
MIN_WIDTH_UNIT varchar(255),
|
||||||
|
MIN_WIDTH_VALUE float,
|
||||||
|
primary key (MEDIA_QUERY_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.STYLE_MEDIA_RULES (
|
||||||
|
MEDIA_RULE_ID bigint not null,
|
||||||
|
MEDIA_QUERY_ID bigint,
|
||||||
|
STYLE_ID bigint,
|
||||||
|
primary key (MEDIA_RULE_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.STYLE_PROPERTIES (
|
||||||
|
PROPERTY_ID bigint not null,
|
||||||
|
NAME varchar(256),
|
||||||
|
PROPERTY_VALUE varchar(4096),
|
||||||
|
RULE_ID bigint,
|
||||||
|
primary key (PROPERTY_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.STYLE_RULES (
|
||||||
|
RULE_ID bigint not null,
|
||||||
|
SELECTOR varchar(2048),
|
||||||
|
STYLE_ID bigint,
|
||||||
|
primary key (RULE_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.STYLES (
|
||||||
|
STYLE_ID bigint not null,
|
||||||
|
STYLENAME varchar(255),
|
||||||
|
primary key (STYLE_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
alter table CCM_CORE.PAGE_MODEL_COMPONENT_MODELS
|
||||||
|
add constraint FK1uvkayybawff8sqkmerqt60bk
|
||||||
|
foreign key (CONTAINER_ID)
|
||||||
|
references CCM_CORE.PAGE_MODEL_CONTAINER_MODELS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.PAGE_MODEL_CONTAINER_MODELS
|
||||||
|
add constraint FK1c6drneacxveol92vpum79fxb
|
||||||
|
foreign key (PAGE_MODEL_ID)
|
||||||
|
references CCM_CORE.PAGE_MODELS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.PAGE_MODEL_CONTAINER_MODELS
|
||||||
|
add constraint FKoi5wphv3vtwryc19akku28p24
|
||||||
|
foreign key (STYLE_ID)
|
||||||
|
references CCM_CORE.STYLES;
|
||||||
|
|
||||||
|
|
||||||
|
alter table CCM_CORE.STYLE_MEDIA_RULES
|
||||||
|
add constraint FKdq24a4atxp4c1sbqs8g6lpkx0
|
||||||
|
foreign key (MEDIA_QUERY_ID)
|
||||||
|
references CCM_CORE.STYLE_MEDIA_QUERIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.STYLE_MEDIA_RULES
|
||||||
|
add constraint FKf67h8q9kkjft9go2xo2572n17
|
||||||
|
foreign key (STYLE_ID)
|
||||||
|
references CCM_CORE.STYLES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.STYLE_PROPERTIES
|
||||||
|
add constraint FKg2g0n7jmce3vjmula0898yp94
|
||||||
|
foreign key (RULE_ID)
|
||||||
|
references CCM_CORE.STYLE_RULES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.STYLE_RULES
|
||||||
|
add constraint FKcbr0k93g001jix7i4kncsce1w
|
||||||
|
foreign key (STYLE_ID)
|
||||||
|
references CCM_CORE.STYLES;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
-- drop obsolete columns
|
||||||
|
|
||||||
|
alter table CCM_CORE.PAGE_MODEL_COMPONENT_MODELS
|
||||||
|
drop constraint FKo696ch035fe7rrueol1po13od
|
||||||
|
|
||||||
|
alter table CCM_CORE.PAGE_MODEL_COMPONENT_MODELS add column PAGE_MODEL_ID bigint;
|
||||||
|
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
-- Remove obsolete tables
|
||||||
|
|
||||||
|
alter table CCM_CORE.FLEX_LAYOUT_BOXES
|
||||||
|
drop constraint FKeiqh69t1lr7u09hjuxfyxsbs;
|
||||||
|
|
||||||
|
alter table CCM_CORE.FLEX_LAYOUT_BOXES
|
||||||
|
drop constraint FKmrobhhqidcf1657ugcgatrd0y;
|
||||||
|
|
||||||
|
alter table CCM_CORE.FLEX_LAYOUT_COMPONENTS
|
||||||
|
drop constraint FK8qxnqt75ikxtedx0xreoeiygg;
|
||||||
|
|
||||||
|
drop table CCM_CORE.FLEX_LAYOUT_COMPONENTS;
|
||||||
|
|
||||||
|
drop table CCM_CORE.FLEX_LAYOUT_BOXES;
|
||||||
|
|
||||||
|
-- Create new tables and columns
|
||||||
|
|
||||||
|
alter table CCM_CORE.PAGE_MODEL_COMPONENT_MODELS
|
||||||
|
add column CONTAINER_ID int8;
|
||||||
|
|
||||||
|
create table CCM_CORE.PAGE_MODEL_CONTAINER_MODELS (
|
||||||
|
CONTAINER_ID int8 not null,
|
||||||
|
CONTAINER_UUID varchar(255) not null,
|
||||||
|
CONTAINER_KEY varchar(255),
|
||||||
|
UUID varchar(255) not null,
|
||||||
|
PAGE_MODEL_ID int8,
|
||||||
|
STYLE_ID int8,
|
||||||
|
primary key (CONTAINER_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.STYLE_MEDIA_QUERIES (
|
||||||
|
MEDIA_QUERY_ID int8 not null,
|
||||||
|
MAX_WIDTH_UNIT varchar(255),
|
||||||
|
MAX_WIDTH_VALUE float4,
|
||||||
|
MEDIA_TYPE varchar(255),
|
||||||
|
MIN_WIDTH_UNIT varchar(255),
|
||||||
|
MIN_WIDTH_VALUE float4,
|
||||||
|
primary key (MEDIA_QUERY_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.STYLE_MEDIA_RULES (
|
||||||
|
MEDIA_RULE_ID int8 not null,
|
||||||
|
MEDIA_QUERY_ID int8,
|
||||||
|
STYLE_ID int8,
|
||||||
|
primary key (MEDIA_RULE_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.STYLE_PROPERTIES (
|
||||||
|
PROPERTY_ID int8 not null,
|
||||||
|
NAME varchar(256),
|
||||||
|
PROPERTY_VALUE varchar(4096),
|
||||||
|
RULE_ID int8,
|
||||||
|
primary key (PROPERTY_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.STYLE_RULES (
|
||||||
|
RULE_ID int8 not null,
|
||||||
|
SELECTOR varchar(2048),
|
||||||
|
STYLE_ID int8,
|
||||||
|
primary key (RULE_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.STYLES (
|
||||||
|
STYLE_ID int8 not null,
|
||||||
|
STYLENAME varchar(255),
|
||||||
|
primary key (STYLE_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
alter table CCM_CORE.PAGE_MODEL_COMPONENT_MODELS
|
||||||
|
add constraint FK1uvkayybawff8sqkmerqt60bk
|
||||||
|
foreign key (CONTAINER_ID)
|
||||||
|
references CCM_CORE.PAGE_MODEL_CONTAINER_MODELS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.PAGE_MODEL_CONTAINER_MODELS
|
||||||
|
add constraint FK1c6drneacxveol92vpum79fxb
|
||||||
|
foreign key (PAGE_MODEL_ID)
|
||||||
|
references CCM_CORE.PAGE_MODELS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.PAGE_MODEL_CONTAINER_MODELS
|
||||||
|
add constraint FKoi5wphv3vtwryc19akku28p24
|
||||||
|
foreign key (STYLE_ID)
|
||||||
|
references CCM_CORE.STYLES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.STYLE_MEDIA_RULES
|
||||||
|
add constraint FKdq24a4atxp4c1sbqs8g6lpkx0
|
||||||
|
foreign key (MEDIA_QUERY_ID)
|
||||||
|
references CCM_CORE.STYLE_MEDIA_QUERIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.STYLE_MEDIA_RULES
|
||||||
|
add constraint FKf67h8q9kkjft9go2xo2572n17
|
||||||
|
foreign key (STYLE_ID)
|
||||||
|
references CCM_CORE.STYLES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.STYLE_PROPERTIES
|
||||||
|
add constraint FKg2g0n7jmce3vjmula0898yp94
|
||||||
|
foreign key (RULE_ID)
|
||||||
|
references CCM_CORE.STYLE_RULES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.STYLE_RULES
|
||||||
|
add constraint FKcbr0k93g001jix7i4kncsce1w
|
||||||
|
foreign key (STYLE_ID)
|
||||||
|
references CCM_CORE.STYLES;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
-- drop obsolete columns
|
||||||
|
|
||||||
|
alter table CCM_CORE.PAGE_MODEL_COMPONENT_MODELS
|
||||||
|
drop constraint FKo696ch035fe7rrueol1po13od;
|
||||||
|
|
||||||
|
alter table CCM_CORE.PAGE_MODEL_COMPONENT_MODELS drop column PAGE_MODEL_ID;
|
||||||
|
|
||||||
Loading…
Reference in New Issue