Skip to content

yejianfei/snowflake-mysql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

snowflake-mysql

using twitter snowflake on mysql function. it's create global auto increment table to provide database level id generator.

notice: the generator function used mysql REPLACE INTO statement, so you can't be use AUTO_INCREMENT on other tables.

usage

  • if you want use your own epoch day. you can change the function variable of epoch,find it at gen_ticket64.sql.
  • when you have multiple databases to want using it, you must be change the function variable of node on each database.find it at gen_ticket64.sql.
  • execute tb_tickets.sql first to create global auto increment table, then execute gen_ticket64.sql to create the mysql function.
  • use SELECT gen_ticket64() statement get id.

About

snowflake mysql function script

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages