You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// ON UPDATE NOW() has an FSP (fractional seconds precision)
202
-
// It cannot be added if it differs from the column TIMESTAMP FSP
203
-
// Warn the user if it differs
204
-
// Possibly add warn for generate command
205
-
// @AlexSherman added this
206
-
207
-
// for (const statement of statements) {
208
-
// if (statement.type === 'drop_table') {
209
-
// const res = await db.query(`select 1 from \`${statement.table}\` limit 1`);
210
-
// if (res.length > 0) {
211
-
// hints.push(`· You're about to delete non-empty ${chalk.underline(statement.table)} table`);
212
-
// }
213
-
// } else if (statement.type === 'drop_column') {
214
-
// const res = await db.query(
215
-
// `select 1 from \`${statement.column.table}\` limit 1`,
216
-
// );
217
-
// if (res.length > 0) {
218
-
// hints.push(
219
-
// `· You're about to delete ${
220
-
// chalk.underline(
221
-
// statement.column.name,
222
-
// )
223
-
// } column in a non-empty ${statement.column.table} table with`,
224
-
// );
225
-
// }
226
-
// } else if (statement.type === 'alter_column') {
227
-
// // alter column set type
228
-
// // alter column set not null
229
-
// `· You're about to set not-null constraint to ${
230
-
// chalk.underline(statement.columnName)
231
-
// } column without default, which contains ${count} items`;
232
-
// `· You're about to remove default value from ${
233
-
// chalk.underline(statement.columnName)
234
-
// } not-null column with ${count} items`;
235
-
236
-
// // if drop pk and json2 has autoincrement in table -> exit process with error
237
-
// `${
238
-
// withStyle.errorWarning(
239
-
// `You have removed the primary key from a ${statement.tableName} table without removing the auto-increment property from this table. As the database error states: 'there can be only one auto column, and it must be defined as a key. Make sure to remove autoincrement from ${statement.tableName} table`,
240
-
// )
241
-
// }`;
242
-
// `· You're about to change ${
243
-
// chalk.underline(statement.tableName)
244
-
// } primary key. This statements may fail and you table may left without primary key`;
245
-
246
-
// // if drop pk and json2 has autoincrement in table -> exit process with error
247
-
// `· You have removed the primary key from a ${statement.tableName} table without removing the auto-increment property from this table. As the database error states: 'there can be only one auto column, and it must be defined as a key. Make sure to remove autoincrement from ${statement.tableName} table`;
248
-
// `· You're about to add not-null ${
249
-
// chalk.underline(statement.column.name)
250
-
// } column without default value, which contains ${count} items`;
251
-
252
-
// const res = await db.query(
253
-
// `select count(*) as count from \`${statement.tableName}\``,
254
-
// );
255
-
// const count = Number(res[0].count);
256
-
// if (count > 0) {
257
-
// `· You're about to change ${
258
-
// chalk.underline(
259
-
// statement.columnName,
260
-
// )
261
-
// } column type from ${
262
-
// chalk.underline(
263
-
// statement.oldDataType,
264
-
// )
265
-
// } to ${chalk.underline(statement.newDataType)} with ${count} items`;
266
-
// }
267
-
// } else if (statement.type === 'create_index' && statement.index.unique) {
268
-
// const res = await db.query(
269
-
// `select 1 from \`${statement.index.table}\` limit 1`,
270
-
// );
271
-
// const count = Number(res[0].count);
272
-
// if (count > 0) {
273
-
// console.log(
274
-
// `· You're about to add ${
275
-
// chalk.underline(
276
-
// statement.index.name,
277
-
// )
278
-
// } unique constraint to the table, which contains ${count} items. If this statement fails, you will receive an error from the database. Do you want to truncate ${
279
-
// chalk.underline(
280
-
// statement.index.table,
281
-
// )
282
-
// } table?\n`,
283
-
// );
284
-
// const { status, data } = await render(
285
-
// new Select([
286
-
// 'No, add the constraint without truncating the table',
0 commit comments