File tree Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -408,3 +408,64 @@ Object {
408408
409409 await pgMeta . tables . remove ( testTable ! . id )
410410} )
411+
412+ test ( 'update is_unique' , async ( ) => {
413+ const { data : testTable } = await pgMeta . tables . create ( { name : 't' } )
414+
415+ let res = await pgMeta . columns . create ( {
416+ table_id : testTable ! . id ,
417+ name : 'c' ,
418+ type : 'text' ,
419+ is_unique : false ,
420+ } )
421+ res = await pgMeta . columns . update ( res . data ! . id , { is_unique : true } )
422+ expect ( res ) . toMatchInlineSnapshot ( `
423+ Object {
424+ "data": Object {
425+ "comment": null,
426+ "data_type": "text",
427+ "default_value": null,
428+ "enums": Array [],
429+ "format": "text",
430+ "id": "16525.1",
431+ "identity_generation": null,
432+ "is_identity": false,
433+ "is_nullable": true,
434+ "is_unique": true,
435+ "is_updatable": true,
436+ "name": "c",
437+ "ordinal_position": 1,
438+ "schema": "public",
439+ "table": "t",
440+ "table_id": 16525,
441+ },
442+ "error": null,
443+ }
444+ ` )
445+ res = await pgMeta . columns . update ( res . data ! . id , { is_unique : false } )
446+ expect ( res ) . toMatchInlineSnapshot ( `
447+ Object {
448+ "data": Object {
449+ "comment": null,
450+ "data_type": "text",
451+ "default_value": null,
452+ "enums": Array [],
453+ "format": "text",
454+ "id": "16525.1",
455+ "identity_generation": null,
456+ "is_identity": false,
457+ "is_nullable": true,
458+ "is_unique": false,
459+ "is_updatable": true,
460+ "name": "c",
461+ "ordinal_position": 1,
462+ "schema": "public",
463+ "table": "t",
464+ "table_id": 16525,
465+ },
466+ "error": null,
467+ }
468+ ` )
469+
470+ await pgMeta . tables . remove ( testTable ! . id )
471+ } )
You can’t perform that action at this time.
0 commit comments