这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ const ColumnEditor = ({
const styles = require('./ModifyTable.scss');

useEffect(() => {
dispatch(editColumn(colName, 'comment', columnComment));
if (columnComment) {
dispatch(editColumn(colName, 'comment', columnComment[0] || ''));
}
}, [columnComment]);

// filter the datatypes where hasuraDatatype === null
Expand Down
38 changes: 19 additions & 19 deletions console/src/components/Services/Data/TableModify/ModifyActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ const savePrimaryKeys = (tableName, schemaName, constraintName) => {
sql: `
alter table "${schemaName}"."${tableName}"
add constraint "${tableName}_pkey" primary key ( ${selectedPkColumns.join(
', '
)} );
', '
)} );
`,
},
});
Expand All @@ -183,8 +183,8 @@ const savePrimaryKeys = (tableName, schemaName, constraintName) => {
sql: `
alter table "${schemaName}"."${tableName}"
add constraint "${constraintName}" primary key ( ${tableSchema.primary_key.columns.join(
', '
)} );
', '
)} );
`,
});
}
Expand Down Expand Up @@ -1056,9 +1056,9 @@ const saveColumnChangesSql = (colName, column, allowRename) => {
const newName = allowRename ? columnEdit.name : null;
const currentSchema = columnEdit.schemaName;
// ALTER TABLE <table> ALTER COLUMN <column> TYPE <column_type>;
let defWithQuotes = "''";
if (colType === 'text' && def !== '') {
defWithQuotes = "'" + def + "'";
let defWithQuotes;
if (colType === 'text') {
defWithQuotes = `'${def}'`;
} else {
defWithQuotes = def;
}
Expand Down Expand Up @@ -1110,24 +1110,24 @@ const saveColumnChangesSql = (colName, column, allowRename) => {
const schemaChangesUp =
originalColType !== colType
? [
{
type: 'run_sql',
args: {
sql: columnChangesUpQuery,
{
type: 'run_sql',
args: {
sql: columnChangesUpQuery,
},
},
},
]
]
: [];
const schemaChangesDown =
originalColType !== colType
? [
{
type: 'run_sql',
args: {
sql: columnChangesDownQuery,
{
type: 'run_sql',
args: {
sql: columnChangesDownQuery,
},
},
},
]
]
: [];

/* column default up/down migration */
Expand Down