Skip to content

Commit

Permalink
Try to make it work on more DB dialects
Browse files Browse the repository at this point in the history
  • Loading branch information
Hornwitser committed Oct 30, 2024
1 parent 7415f47 commit 0609dfa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sscce-sequelize-7.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export async function run() {
});

class Foo extends Model<InferAttributes<Foo>, InferCreationAttributes<Foo>> {
@Attribute(DataTypes.TEXT)
@Attribute(DataTypes.STRING(100))
@PrimaryKey
declare name: string;

@Attribute(DataTypes.TEXT)
@Attribute(DataTypes.STRING(100))
@PrimaryKey
declare rank: string;

@Attribute(DataTypes.TEXT)
@Attribute(DataTypes.STRING(100))
declare role: CreationOptional<string>;
}

Expand All @@ -48,7 +48,7 @@ export async function run() {

// Altering an unrelated column should not change the above behaviour
await Foo.truncate();
await sequelize.queryInterface.changeColumn("Foos", "role", { type: DataTypes.INTEGER });
await sequelize.queryInterface.changeColumn("Foos", "role", { type: DataTypes.TEXT });
await expect(Foo.create({ name: "bear", rank: "novice" })).to.eventually.be.fulfilled;
await expect(Foo.create({ name: "bear", rank: "expert" })).to.eventually.be.fulfilled;
await expect(Foo.create({ name: "dog", rank: "expert" })).to.eventually.be.fulfilled;
Expand Down

0 comments on commit 0609dfa

Please sign in to comment.