Skip to content

Migrator doesn't support create/drop type #86

@shelly-li-sl

Description

@shelly-li-sl

Seems migrator doesn't support type operations, I couldn't create an Oracle type, or drop an Oracle type using the migrator. I'm currently doing the type create/drop using raw sql like the following. Is there any way to create/drop a type using the migrator?

     dropType := `
	BEGIN
	  EXECUTE IMMEDIATE 'DROP TYPE "email_list_arr"';
	EXCEPTION WHEN OTHERS THEN NULL; END;`
	if err := DB.Exec(dropType).Error; err != nil {
		t.Fatalf("Failed to drop email_list_arr: %v", err)
	}
	createType := `CREATE OR REPLACE TYPE "email_list_arr" AS VARRAY(10) OF VARCHAR2(80)`
	if err := DB.Exec(createType).Error; err != nil {
		t.Fatalf("Failed to create email_list_arr: %v", err)
	}
	createTable := `CREATE TABLE "email_varray_tables" (
		"ID" NUMBER PRIMARY KEY,
		"EMAILS" "email_list_arr"
	)`
	if err := DB.Exec(createTable).Error; err != nil {
		t.Fatalf("Failed to create email_varray_tables: %v", err)
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions