/// <summary>
        /// Extract PrimaryKey Definition from context
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static MySqlKeyDefinition ExtractPrimaryKey(PrimaryKeyTableConstraintContext context)
        {
            if (context == null)
            {
                throw new ArgumentOutOfRangeException($"{nameof(context)} is null");
            }

            var keys   = context.GetIndexNames();
            var pkName = context.GetChildlen <IndexColumnNamesContext>()
                         .Single()
                         .GetText().RemoveBackQuote().RemoveParenthesis();
            var pkIndexes  = keys.Select(x => x.RemoveBackQuote().RemoveParenthesis()).ToArray();
            var definition = new MySqlKeyDefinition
            {
                KeyName = pkName,
                Indexes = pkIndexes.Select((x, i) => new MySqlKeyDetailDefinition
                {
                    Order    = i,
                    IndexKey = x,
                })
                          .ToArray(),
            };

            return(definition);
        }
        /// <summary>
        /// Listener for Primary Key detection
        /// </summary>
        /// <param name="context"></param>
        public override void EnterPrimaryKeyTableConstraint([NotNull] PrimaryKeyTableConstraintContext context)
        {
            base.EnterPrimaryKeyTableConstraint(context);

            // primary key (pk)
            var definition = MySqlKeyDefinition.ExtractPrimaryKey(context);

            TableDefinition.PrimaryKey = definition;

            // map PrimaryKey and existing Column reference
            definition.AddPrimaryKeyReferenceOnColumn(TableDefinition.Columns);
        }
        /// <summary>
        /// Get PrimaryKey names from context.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static string[] GetIndexNames(this PrimaryKeyTableConstraintContext context)
        {
            if (context == null)
            {
                throw new ArgumentOutOfRangeException($"{nameof(context)} is null");
            }
            var result = context.GetChildlen <IndexColumnNamesContext>()
                         .SelectMany(x => x.GetChildlen <IndexColumnNameContext>())
                         .Select(x => x.GetText())
                         .ToArray();

            return(result);
        }