update db migration code to update version and add index

This commit is contained in:
Tan Jiang 2016-07-07 19:05:47 +08:00
parent 2ec20e44c3
commit 84d41794ac
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