mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-15 23:08:20 +00:00
[Update] 修改迁移
This commit is contained in:
@@ -8,18 +8,23 @@ class Migration(migrations.Migration):
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('common', '0006_auto_20190304_1515'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
state_operations = [
|
||||
migrations.CreateModel(
|
||||
name='Setting',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=128, unique=True, verbose_name='Name')),
|
||||
('id', models.AutoField(auto_created=True, primary_key=True,
|
||||
serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=128, unique=True,
|
||||
verbose_name='Name')),
|
||||
('value', models.TextField(verbose_name='Value')),
|
||||
('category', models.CharField(default='default', max_length=128)),
|
||||
('category',
|
||||
models.CharField(default='default', max_length=128)),
|
||||
('encrypted', models.BooleanField(default=False)),
|
||||
('enabled', models.BooleanField(default=True, verbose_name='Enabled')),
|
||||
('enabled',
|
||||
models.BooleanField(default=True, verbose_name='Enabled')),
|
||||
('comment', models.TextField(verbose_name='Comment')),
|
||||
],
|
||||
options={
|
||||
@@ -28,3 +33,7 @@ class Migration(migrations.Migration):
|
||||
},
|
||||
),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.SeparateDatabaseAndState(state_operations=state_operations)
|
||||
]
|
||||
|
@@ -1,19 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
from django.db import migrations, connection
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("settings", "0001_initial"),
|
||||
]
|
||||
sql = "INSERT INTO setting(name, value, category, encrypted, enabled, comment) " \
|
||||
"SELECT name, value, category, encrypted, enabled, comment from settings"
|
||||
rename_sql = "RENAME TABLE settings TO settings_bak"
|
||||
settings_table_exist = 'settings' in connection.introspection.table_names()
|
||||
|
||||
operations = []
|
||||
if settings_table_exist:
|
||||
operations.append(migrations.RunSQL(sql))
|
||||
operations.append(migrations.RunSQL(rename_sql))
|
Reference in New Issue
Block a user