mirror of https://github.com/AMT-Cheif/drift.git
Add test and changelog entry
This commit is contained in:
parent
168a9bfa59
commit
e02a814f5c
|
@ -6,6 +6,7 @@
|
||||||
which tables are affected by the custom statement.
|
which tables are affected by the custom statement.
|
||||||
- For `STRICT` tables in drift files declaring a `ANY` column, drift will now
|
- For `STRICT` tables in drift files declaring a `ANY` column, drift will now
|
||||||
generate a mapping to the new `DriftAny` type.
|
generate a mapping to the new `DriftAny` type.
|
||||||
|
- Add `likeExp` to generate `LIKE` expression with any comparison expression.
|
||||||
- Fix `UNIQUE` keys declared in drift files being written twice.
|
- Fix `UNIQUE` keys declared in drift files being written twice.
|
||||||
- Fix `customConstraints` not appearing in dumped database schema files.
|
- Fix `customConstraints` not appearing in dumped database schema files.
|
||||||
- Work-around an issue causing complex migrations via `Migrator.alterTable` not to
|
- Work-around an issue causing complex migrations via `Migrator.alterTable` not to
|
||||||
|
|
|
@ -1,20 +1,15 @@
|
||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
import '../../generated/todos.dart';
|
|
||||||
import '../../test_utils/test_utils.dart';
|
import '../../test_utils/test_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
const expression =
|
const expression =
|
||||||
CustomExpression<String>('col', precedence: Precedence.primary);
|
CustomExpression<String>('col', precedence: Precedence.primary);
|
||||||
final db = TodoDb();
|
|
||||||
|
|
||||||
test('generates like expressions', () {
|
test('generates like expressions', () {
|
||||||
final ctx = GenerationContext.fromDb(db);
|
expect(expression.like('pattern'), generates('col LIKE ?', ['pattern']));
|
||||||
expression.like('pattern').writeInto(ctx);
|
expect(expression.likeExp(expression), generates('col LIKE col'));
|
||||||
|
|
||||||
expect(ctx.sql, 'col LIKE ?');
|
|
||||||
expect(ctx.boundVariables, ['pattern']);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('generates regexp expressions', () {
|
test('generates regexp expressions', () {
|
||||||
|
|
Loading…
Reference in New Issue