fixes
This commit is contained in:
		@@ -2,6 +2,6 @@ import { Snippet } from '../../Snippet';
 | 
			
		||||
 | 
			
		||||
export default class Database implements Snippet {
 | 
			
		||||
  public start (): Promise<void> {
 | 
			
		||||
    // noop
 | 
			
		||||
    return new Promise ((res) => res ());
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,18 @@ export class RenameColumn implements Serializable, PatchAction {
 | 
			
		||||
 | 
			
		||||
  public apply (db: Database): void {
 | 
			
		||||
    const table = db.get_table (this.table);
 | 
			
		||||
    const column = table?.get_column(this.column);
 | 
			
		||||
    column?.name = this.new_name;
 | 
			
		||||
    if (typeof table === 'undefined' || table === null) {
 | 
			
		||||
      throw new Error (
 | 
			
		||||
        `table ${this.table} not found`
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
    const column = table.get_column (this.column);
 | 
			
		||||
    if (typeof column === 'undefined' || column === null) {
 | 
			
		||||
      throw new Error (
 | 
			
		||||
        `column ${this.column} not found in table ${this.table}`
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    column.name = this.new_name;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
import path from 'path';
 | 
			
		||||
import { Input } from 'enquirer';
 | 
			
		||||
import { Input, Confirm } from 'enquirer';
 | 
			
		||||
import { Snippet } from '../../Snippet';
 | 
			
		||||
import { apply_template, modify_json, run_command } from '../../Helper';
 | 
			
		||||
 | 
			
		||||
@@ -19,7 +19,7 @@ export default class Node implements Snippet {
 | 
			
		||||
    )
 | 
			
		||||
      .run ();
 | 
			
		||||
 | 
			
		||||
    const use_ts = await new confirm ({
 | 
			
		||||
    const use_ts = await new Confirm ({
 | 
			
		||||
      message: 'use typescript?',
 | 
			
		||||
      initial: false
 | 
			
		||||
    })
 | 
			
		||||
@@ -50,7 +50,7 @@ export default class Node implements Snippet {
 | 
			
		||||
        test: 'nyc ava'
 | 
			
		||||
      };
 | 
			
		||||
      if (use_ts)
 | 
			
		||||
        obj.scripts.compile = 'tsc';
 | 
			
		||||
        (obj.scripts as Record<string, unknown>).compile = 'tsc';
 | 
			
		||||
      return obj;
 | 
			
		||||
    }, path.join (folder, 'package.json'));
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user