Question: I was wondering if it's possible to rename just part of a file name with a node.js script. I'm using node.js with fs. But I can only rename the whole thing.

```
1   const fs = require('fs');
  2 fs.readFile('./test.json', function(error, data) {
  3     if (error) {
  4         console.log(error);
  5         return;
  6     }
  7 
  8     var obj = JSON.parse(data);
  9     for(var p in obj) {
 10         fs.rename('./' + obj[p] + '.jpg', './' + p + '.jpg', function(err) {
 11             if ( err ) console.log('ERROR: ' + err);
 12         });
 13     }
 14 });

```

~ 

and this is my json file

```
1 {
  2         "DEC19" : "2019-12-08",
  3         "MAY19" : "2019-05-26"
  4 }

```

this json file contains only the part of the name that I want to change.

hope you can help me, and thanks (:

Answer: 
If you want to **remove** the `DEFAULT` value of a column you must define the `oldDefaultValue`.

```
// drop default
migrationBuilder.AlterColumn<bool>(
                name: "col",
                table: "my_table",
                oldDefaultValue: true, <-- THIS must be defined!
                defaultValue: null);

// Resulting Query: ALTER TABLE my_table ALTER COLUMN col DROP DEFAULT

```

Make also sure that the `<type>`, `name` (..) are also correct, because EfCore **won't** complain anything if your written `AlterColumn` statement is garbage.

---

Furthermore if your table already contains rows and you would like to add a new column with none `DEFAULT`, do the following:

```
// add column WITH default for existing rows
migrationBuilder.AddColumn<bool>(
                name: "col",
                table: "my_table",
                type: "boolean",
                nullable: false,
                defaultValue: true);

// drop default for new entries
migrationBuilder.AlterColumn<bool>(
                name: "col",
                table: "my_table",
                oldDefaultValue: true,
                defaultValue: null);

```
The code in your question should cause the default constraint to be removed. Are you sure it still exists? It might pay to look at the SQL that is generated when this migration is applied to the database.

With the following migration:

```
migrationBuilder.AddColumn<bool>(
    name: "MyColumn",
    table: "MyTable",
    nullable: false,
    defaultValue: true);

migrationBuilder.AlterColumn<bool>(
    name: "MyColumn",
    table: "MyTable",
    nullable: false,
    defaultValue: null);

```

The following SQL is generated when applying the migration:

```
ALTER TABLE [MyTable] ADD [MyColumn] bit NOT NULL DEFAULT CAST(1 AS bit);

DECLARE @var0 sysname;
      SELECT @var0 = [d].[name]
      FROM [sys].[default_constraints] [d]
      INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id]
      WHERE ([d].[parent_object_id] = OBJECT_ID(N'[MyTable]') AND [c].[name] = N'MyColumn');
      IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [MyTable] DROP CONSTRAINT [' + @var0 + '];');
      ALTER TABLE [MyTable] ALTER COLUMN [MyColumn] bit NOT NULL;

```

Ever since [this issue](https://github.com/dotnet/efcore/issues/1345) was fixed, default constraints should be removed on each call to AlterColumn. You'll note the majority of that migration SQL is responsible for determining the name of and dropping the default constraint on the `MyColumn` field.