Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It seems that DELIMITER cannot be handled well #566

Open
try-agaaain opened this issue Apr 30, 2024 · 1 comment
Open

It seems that DELIMITER cannot be handled well #566

try-agaaain opened this issue Apr 30, 2024 · 1 comment

Comments

@try-agaaain
Copy link

I try to convert sakila/sakila-mv-schema.sql to DBML format, but in this file There are a lot of DELIMITER. When sql2dbml encounters these symbols, the following error will appear:

$ sql2dbml --mysql ./sakila/sakila-mv-schema.sql -o mydatabase.dbml
  ERROR: 
    You have a syntax error at "sakila-mv-schema.sql" line 189 column 0. mismatched input 'DELIMITER' expecting {<EOF>, '-'}

  A complete log can be found in:
     /workspace/test_db/dbml-error.log

The code at "sakila-mv-schema.sql" line 189 is as follows:

...

CREATE TABLE film_text (
  film_id SMALLINT NOT NULL,
  title VARCHAR(255) NOT NULL,
  description TEXT,
  PRIMARY KEY  (film_id),
  FULLTEXT KEY idx_title_description (title,description)
)ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- After MySQL 5.6.10, InnoDB supports fulltext indexes
/*!50610 ALTER TABLE film_text engine=InnoDB */;

--
-- Triggers for loading film_text from film
--

DELIMITER ;;
CREATE TRIGGER `ins_film` AFTER INSERT ON `film` FOR EACH ROW BEGIN
    INSERT INTO film_text (film_id, title, description)
        VALUES (new.film_id, new.title, new.description);
  END;;


CREATE TRIGGER `upd_film` AFTER UPDATE ON `film` FOR EACH ROW BEGIN
    IF (old.title != new.title) OR (old.description != new.description) OR (old.film_id != new.film_id)
    THEN
        UPDATE film_text
            SET title=new.title,
                description=new.description,
                film_id=new.film_id
        WHERE film_id=old.film_id;
    END IF;
  END;;
...
@goroya
Copy link

goroya commented Aug 22, 2024

me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants