Merge pull request #497 from reasonerjt/job-service

update db migration code to update version and add index
This commit is contained in:
Daniel Jiang 2016-07-07 19:25:44 +08:00 committed by GitHub
commit 876db4804e
3 changed files with 6 additions and 7 deletions

View File

@ -143,7 +143,8 @@ create table replication_job (
tags varchar(16384),
creation_time timestamp default CURRENT_TIMESTAMP,
update_time timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (id)
PRIMARY KEY (id),
INDEX policy (policy_id)
);
create table properties (
@ -152,11 +153,8 @@ create table properties (
primary key (k)
);
insert into properties (k, v) values
('schema_version', '0.1.1');
CREATE TABLE IF NOT EXISTS `alembic_version` (
`version_num` varchar(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into alembic_version values ('0.2.0');
insert into alembic_version values ('0.3.0');

View File

@ -124,3 +124,4 @@ class ReplicationJob(Base):
creation_time = sa.Column(mysql.TIMESTAMP, server_default = sa.text("CURRENT_TIMESTAMP"))
update_time = sa.Column(mysql.TIMESTAMP, server_default = sa.text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
__table_args__ = (sa.Index('policy', "policy_id"),)

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""0.1.1 to 0.2.0
"""0.1.1 to 0.3.0
Revision ID: 0.1.1
Revises:
@ -20,7 +20,7 @@ Revises:
"""
# revision identifiers, used by Alembic.
revision = '0.2.0'
revision = '0.3.0'
down_revision = '0.1.1'
branch_labels = None
depends_on = None